package com.sky.service.impl;

import com.sky.entity.AddressBook;
import com.sky.mapper.AddressBookMapper;
import com.sky.service.AddressBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressBookServiceImpl implements AddressBookService {
    @Autowired
    private AddressBookMapper addressBookMapper;

    /**
     * 查询地址簿列表
     *
     * @param addressBook
     * @return
     */
    @Override
    public List<AddressBook> list(AddressBook addressBook) {
        return addressBookMapper.list(addressBook);
    }

    /**
     * 保存地址簿
     *
     * @param addressBook
     */
    @Override
    public void save(AddressBook addressBook) {
        addressBookMapper.save(addressBook);
    }

    /**
     * 设置默认地址簿
     *
     * @param addressBook
     */
    @Override
    public void setDefault(AddressBook addressBook) {
        addressBookMapper.setDefault(addressBook);
    }

    /**
     * 获取默认地址簿
     *
     * @param addressBook
     */
    @Override
    public List<AddressBook> getDefault(AddressBook addressBook) {
        return addressBookMapper.list(addressBook);
    }

    /**
     * 根据id获取地址簿
     *
     * @param id
     * @return
     */
    @Override
    public AddressBook getById(Long id) {
        return addressBookMapper.getById(id);
    }

    /**
     * 修改地址簿信息
     *
     * @param addressBook
     */
    @Override
    public void update(AddressBook addressBook) {
        addressBookMapper.update(addressBook);
    }

    @Override
    public void delete(Long id) {
        addressBookMapper.delete(id);
    }


}


